package se.perp.c4.model;

public class Card {

    public enum ECard {
        NONE,
        ATTACK_1, ATTACK_2, ATTACK_3, ATTACK_4, ATTACK_5, ATTACK_6,
        RETREAT_BACK, RETREAT_SIDEWAYS, MAGIC,
        ELVEN_CLOAK, NOBLE_SACRIFICE, EYE_OF_SAURON
    };
    public final ECard type;
    public final String text;
    public final Actor.Side side;
    public final String stringRep;
    public final String name;

    public Card(ECard type, Actor.Side side) {
        this.type = type;
        this.side = side;
        switch (type) {
            case ATTACK_1:
                text = "Increases the attack value by 1.";
                stringRep = "1";
                name = "1";
                break;
            case ATTACK_2:
                text = "Increases the attack value by 2.";
                stringRep = "2";
                name = "2";
                break;
            case ATTACK_3:
                text = "Increases the attack value by 3.";
                stringRep = "3";
                name = "3";

                break;
            case ATTACK_4:
                text = "Increases the attack value by 4.";
                stringRep = "4";
                name = "4";

                break;
            case ATTACK_5:
                text = "Increases the attack value by 5.";
                stringRep = "5";
                name = "5";

                break;
            case ATTACK_6:
                text = "Increases the attack value by 6.";
                stringRep = "6";
                name = "6";

                break;
            case ELVEN_CLOAK:
                text = "Ignore strength value of opponent's card.";
                stringRep = "EC";
                name = "Elven Cloak";
                break;
            case EYE_OF_SAURON:
                text = "Ignore text of opponent's card.";
                stringRep = "ES";
                name = "Eye of Sauron";
                break;
            case MAGIC:
                text = "Replace this card with a previously played card.";
                stringRep = "M";
                name = "Magic";
                break;
            case NOBLE_SACRIFICE:
                text = "Both characters are instantly defeated.";
                stringRep = "NS";
                name = "Noble Sacrifice";
                break;
            case RETREAT_BACK:
                text = "Immediately retreat <i>backwards</i>.";
                stringRep = "R";
                name = "Retreat";
                break;
            case RETREAT_SIDEWAYS:
                text = "Immediately retreat <i>sideways</i>.";
                stringRep = "R";
                name = "Retreat";
                break;
            default:
                throw new IllegalArgumentException();
        }
    }

    public static int attackValue(ECard type) {
        switch (type) {
            case ATTACK_1:
                return 1;
            case ATTACK_2:
                return 2;
            case ATTACK_3:
                return 3;
            case ATTACK_4:
                return 4;
            case ATTACK_5:
                return 5;
            case ATTACK_6:
                return 6;
            default:
                return 0;
        }
    }

    @Override
    public String toString() {
        return type.toString();
    }
}
